package lib.random;

/**
 * Generate random sequences;
 * 
 * @author dolphinigle
 *
 */
public class RandomSequence {

  /**
   * Random source
   */
  protected ExtendedRandom random_;

  /**
   * Constructs a random graph generator
   * @param random base random seed source
   */
  public RandomSequence(ExtendedRandom random) {
    random_ = random;
  }
  
  /**
   * Picks a random subsequence (have same relative ordering)
   * of the given long[]
   */
  public long[] RandomSubsetLong(long[] in, int jml) {
    assert jml <= in.length;
    long[] ret = new long[jml];
    int[] picks = random_.nextCombination(in.length, jml);
    for (int i = 0; i < picks.length; ++i) {
      ret[i] = in[picks[i]];
    }
    return ret;
  }

}
